package com.example.permanentroom;

import Entity.User;
import Service.UserService;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;

public class register extends AppCompatActivity {
    private EditText password_view;
    private EditText username_view;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.register);
    }



    public void register(View view) {
        String password = (password_view=(EditText) findViewById(R.id.password)).getText().toString();
        String username = (username_view=(EditText) findViewById(R.id.username)).getText().toString();
        User theuser=new User(0,username,password);
        UserService userService=new UserService();
        boolean ok=userService.register(theuser);
       System.out.println(ok);
        Toast.makeText(this, "注册成功", Toast.LENGTH_LONG).show();
    }

}